<div class="content-wrapper">
	<section class="content-header">
		<h1>应用列表</h1>
		<ol class="breadcrumb">
			<li><a href="/admin"><i class="fa fa-dashboard"></i> 首页</a></li>
			<li class="active">应用管理</li>
			<li class="active">应用列表</li>
		</ol>
	</section>
	<section class="content">
		<div class="box">
			<!--<div class="box-header with-border">
				<button type="button" class="btn btn-info" onclick="window.location.href='/admin/app/editApp'">新增</button>
			</div>-->
			<div class="box-body">
				<table class="table table-bordered">
					<tbody>
						<tr>
							<th style="width: 40px">ID</th>
							<th>APP ID</th>
							<th>应用名称</th>
							<th>是否加密</th>
							<th>应用类型</th>
							<th>应用状态</th>
							<th>添加时间</th>
							<!--<th style="width: 215px">操作</th>-->
						</tr>
						<foreach name="appList" item="app">
                        	<tr>
                        		<td>{$app.id}</td>
                        		<td>{$app.app_id}</td>
                        		<td>{$app.name}</td>
                        		<td><if condition="$app.is_encryption eq 1">加密<else/>不加密</if></td>
                        		<td>
                       			    <switch name="app.type"> 
                       			    	<case value="1">内部系统</case> 
                       			    	<case value="2">APP</case> 
                       			    	<case value="3">WEB站点</case> 
                       			    	<default />外部应用
									</switch>
                       			<td><if condition="$app.status eq 1">正常<else/>已删除</if></td>
                        		<td>{$app.create_time|date="Y-m-d",###}</td>
                        		<!--<td>
                        			<button class="btn btn-info btn-xs" type="button" onclick="window.location.href='/admin/app/editApp?id={$app.id}'">编辑</button>&nbsp;
                        			<if condition="$app.type eq 2">
                        				<button class="btn btn-primary btn-xs" type="button" onclick="window.location.href='/admin/app/versionList?id={$app.id}'">版本列表</button>&nbsp;
                        			</if>
                        			<if condition="$app.status eq 1">
                        				<button class="btn btn-danger btn-xs delete-btn" type="button" data-id="{$app.id}">删除</button>&nbsp;
                        			</if>
                        		</td>-->
                        	</tr>
                        </foreach>
					</tbody>
				</table>
			</div>			
		</div>
	</section>
</div>

<script type="text/javascript">
$(function(){
	//删除应用
	$(".delete-btn").click(function(){
		var id = $(this).attr('data-id');
		
		ArtDialogHlp.showConfirm('警告', '确定要删除该应用？',function(){
			$.post('/admin/app/deleteApp', {id:id}, function(data){
				if(data.Code == 999) {
					ArtDialogHlp.showInfo('提示', '操作成功', function(){
						window.location.href = '/admin/app/appList';
					});
				} else {
					ArtDialogHlp.showInfo('提示', data.Msg);
				}
			}, 'json');
		});
	});
});
</script>